<!-- saved from url=(0014)about:internet -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>PaginatedItemsControl.mxml</title>
<link rel="stylesheet" type="text/css" href="../../SourceStyles.css"/>
</head>

<body><pre><span class="MXMLProcessing_Instruction">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;</span>
<span class="MXMLComponent_Tag">&lt;jwolib:PaginatedItemsControlBase</span><span class="MXMLDefault_Text"> 
    direction=&quot;</span><span class="MXMLString">horizontal</span><span class="MXMLDefault_Text">&quot;
    verticalAlign=&quot;</span><span class="MXMLString">middle</span><span class="MXMLDefault_Text">&quot;
    horizontalAlign=&quot;</span><span class="MXMLString">center</span><span class="MXMLDefault_Text">&quot;
    
    selectedItemsChanged=&quot;</span><span class="ActionScriptDefault_Text">updateDisplayText</span><span class="ActionScriptBracket/Brace">()</span>;<span class="MXMLDefault_Text">&quot;
    
    xmlns:mx=&quot;</span><span class="MXMLString">http://www.adobe.com/2006/mxml</span><span class="MXMLDefault_Text">&quot; 
    xmlns:jwolib=&quot;</span><span class="MXMLString">http://www.jwolib.com/2006/mxml</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">&gt;</span>
    
    <span class="MXMLSpecial_Tag">&lt;mx:Script&gt;</span>
        <span class="ActionScriptOperator">&lt;!</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">CDATA</span><span class="ActionScriptBracket/Brace">[</span>
            
            <span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptMetadata">Bindable</span><span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptReserved">public</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">prevButtonLabel</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&lt;&quot;</span>;
            <span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptMetadata">Bindable</span><span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptReserved">public</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">nextButtonLabel</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&gt;&quot;</span>;
            
            <span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptMetadata">Bindable</span><span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">_display_txt</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;(0 - 0 of 0 results)&quot;</span>;
            
            <span class="ActionScriptReserved">public</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">displayFormat</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;(@F - @L of @T results)&quot;</span>;
            
            <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">updateDisplayText</span> <span class="ActionScriptBracket/Brace">()</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">currentSet</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">selectedIndex</span> <span class="ActionScriptOperator">+</span> 1;
                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">totalItems</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">dataProvider</span>.<span class="ActionScriptDefault_Text">length</span>;
                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">firstItemInSet</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">selectedIndex</span> <span class="ActionScriptOperator">*</span> <span class="ActionScriptDefault_Text">itemsPerPage</span> <span class="ActionScriptOperator">+</span> 1;
                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">lastItemInSet</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">Math</span>.<span class="ActionScriptDefault_Text">min</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">selectedIndex</span> <span class="ActionScriptOperator">*</span> <span class="ActionScriptDefault_Text">itemsPerPage</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">itemsPerPage</span>, <span class="ActionScriptDefault_Text">totalItems</span><span class="ActionScriptBracket/Brace">)</span>;
                
                <span class="ActionScriptDefault_Text">_display_txt</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">displayFormat</span>.<span class="ActionScriptDefault_Text">replace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;@F&quot;</span>, <span class="ActionScriptDefault_Text">firstItemInSet</span><span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">replace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;@L&quot;</span>, <span class="ActionScriptDefault_Text">lastItemInSet</span><span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">replace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;@T&quot;</span>, <span class="ActionScriptDefault_Text">totalItems</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptBracket/Brace">}</span>
            
            <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">onPrevClick</span> <span class="ActionScriptBracket/Brace">()</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">nextIndex</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">selectedIndex</span> <span class="ActionScriptOperator">-</span> 1;
                <span class="ActionScriptDefault_Text">selectedIndex</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">Math</span>.<span class="ActionScriptDefault_Text">max</span><span class="ActionScriptBracket/Brace">(</span>0, <span class="ActionScriptDefault_Text">nextIndex</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptBracket/Brace">}</span>
            
            <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">onNextClick</span> <span class="ActionScriptBracket/Brace">()</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">nextIndex</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">selectedIndex</span> <span class="ActionScriptOperator">+</span> 1;                
                <span class="ActionScriptDefault_Text">selectedIndex</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">Math</span>.<span class="ActionScriptDefault_Text">min</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">pgSets</span> <span class="ActionScriptOperator">-</span> 1, <span class="ActionScriptDefault_Text">nextIndex</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptBracket/Brace">}</span>
            
        <span class="ActionScriptBracket/Brace">]]</span><span class="ActionScriptOperator">&gt;</span>
    <span class="MXMLSpecial_Tag">&lt;/mx:Script&gt;</span>
    
    <span class="MXMLComponent_Tag">&lt;jwolib:states&gt;</span>
        <span class="MXMLComponent_Tag">&lt;mx:State</span><span class="MXMLDefault_Text"> name=&quot;</span><span class="MXMLString">minimum_state</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">&gt;</span>
            <span class="MXMLComponent_Tag">&lt;mx:RemoveChild</span><span class="MXMLDefault_Text"> target=&quot;</span><span class="MXMLString">{</span><span class="ActionScriptDefault_Text">display_lbl</span><span class="MXMLString">}</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
        <span class="MXMLComponent_Tag">&lt;/mx:State&gt;</span>
        
        <span class="MXMLComponent_Tag">&lt;mx:State</span><span class="MXMLDefault_Text"> name=&quot;</span><span class="MXMLString">maximum_state</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">&gt;</span>
            <span class="MXMLComponent_Tag">&lt;mx:AddChild</span><span class="MXMLDefault_Text"> position=&quot;</span><span class="MXMLString">firstChild</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">&gt;</span>
                <span class="MXMLComponent_Tag">&lt;mx:LinkButton</span><span class="MXMLDefault_Text"> label=&quot;</span><span class="MXMLString">&amp;lt;&amp;lt;</span><span class="MXMLDefault_Text">&quot; click=&quot;</span><span class="ActionScriptDefault_Text">selectedIndex</span> <span class="ActionScriptOperator">=</span> 0<span class="MXMLDefault_Text">&quot; enabled=&quot;</span><span class="MXMLString">{</span><span class="ActionScriptDefault_Text">pgSets</span> <span class="ActionScriptOperator">&amp;</span><span class="ActionScriptDefault_Text">gt</span>; 0<span class="MXMLString">}</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
            <span class="MXMLComponent_Tag">&lt;/mx:AddChild&gt;</span>
            
            <span class="MXMLComponent_Tag">&lt;mx:AddChild</span><span class="MXMLDefault_Text"> position=&quot;</span><span class="MXMLString">lastChild</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">&gt;</span>
                <span class="MXMLComponent_Tag">&lt;mx:LinkButton</span><span class="MXMLDefault_Text"> label=&quot;</span><span class="MXMLString">&amp;gt;&amp;gt;</span><span class="MXMLDefault_Text">&quot; click=&quot;</span><span class="ActionScriptDefault_Text">selectedIndex</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">pgSets</span> <span class="ActionScriptOperator">-</span> 1<span class="MXMLDefault_Text">&quot; enabled=&quot;</span><span class="MXMLString">{</span><span class="ActionScriptDefault_Text">pgSets</span> <span class="ActionScriptOperator">&amp;</span><span class="ActionScriptDefault_Text">gt</span>; 0<span class="MXMLString">}</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
            <span class="MXMLComponent_Tag">&lt;/mx:AddChild&gt;</span>
        <span class="MXMLComponent_Tag">&lt;/mx:State&gt;</span>
    <span class="MXMLComponent_Tag">&lt;/jwolib:states&gt;</span>
    
    <span class="MXMLComponent_Tag">&lt;mx:LinkButton</span><span class="MXMLDefault_Text"> id=&quot;</span><span class="MXMLString">prev_btn</span><span class="MXMLDefault_Text">&quot; label=&quot;</span><span class="MXMLString">{</span><span class="ActionScriptDefault_Text">prevButtonLabel</span><span class="MXMLString">}</span><span class="MXMLDefault_Text">&quot; click=&quot;</span><span class="ActionScriptDefault_Text">onPrevClick</span><span class="ActionScriptBracket/Brace">()</span>;<span class="MXMLDefault_Text">&quot;
        enabled=&quot;</span><span class="MXMLString">{</span><span class="ActionScriptDefault_Text">selectedIndex</span> <span class="ActionScriptOperator">&amp;</span><span class="ActionScriptDefault_Text">gt</span>; 0<span class="MXMLString">}</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
    
    <span class="MXMLComponent_Tag">&lt;mx:Label</span><span class="MXMLDefault_Text"> id=&quot;</span><span class="MXMLString">display_lbl</span><span class="MXMLDefault_Text">&quot; text=&quot;</span><span class="MXMLString">{</span><span class="ActionScriptDefault_Text">_display_txt</span><span class="MXMLString">}</span><span class="MXMLDefault_Text">&quot; fontWeight=&quot;</span><span class="MXMLString">bold</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
    
    <span class="MXMLComponent_Tag">&lt;mx:LinkButton</span><span class="MXMLDefault_Text"> id=&quot;</span><span class="MXMLString">next_btn</span><span class="MXMLDefault_Text">&quot; label=&quot;</span><span class="MXMLString">{</span><span class="ActionScriptDefault_Text">nextButtonLabel</span><span class="MXMLString">}</span><span class="MXMLDefault_Text">&quot; click=&quot;</span><span class="ActionScriptDefault_Text">onNextClick</span><span class="ActionScriptBracket/Brace">()</span>;<span class="MXMLDefault_Text">&quot; 
        enabled=&quot;</span><span class="MXMLString">{</span><span class="ActionScriptDefault_Text">pgSets</span> <span class="ActionScriptOperator">&gt;</span> 0 <span class="ActionScriptOperator">&amp;</span><span class="ActionScriptDefault_Text">amp</span>;<span class="ActionScriptOperator">&amp;</span><span class="ActionScriptDefault_Text">amp</span>; <span class="ActionScriptDefault_Text">selectedIndex</span> <span class="ActionScriptOperator">&amp;</span><span class="ActionScriptDefault_Text">lt</span>; <span class="ActionScriptDefault_Text">pgSets</span> <span class="ActionScriptOperator">-</span> 1<span class="MXMLString">}</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
    
<span class="MXMLComponent_Tag">&lt;/jwolib:PaginatedItemsControlBase&gt;</span></pre></body>
</html>
